<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>初始vue</title>
    <script type="text/javascript"  src="../js/vue.js"></script>
</head>


<body>
    <div id="root">
    </div>
</body>
<script type="text/javascript">
    Vue.config.productionTip=false;
    let data={
        name:"JJ",
        address:"清华"
    }
    const obs = new Observer(data);
    console.log(obs)

    let vm ={}
    vm._data= data=obs
    function Observer(obj){
        const keys = Object.keys(obj);
        keys.forEach((k)=>{
            Object.defineProperty(this,k,{
                    get(){
                        return obj[k];
                    },
                    set(val){
                        console.log("我要去解析模板 生成虚拟dom diff比较")
                        obj[k]=val;
                    }
                })
        })
    }
</script>
</html>